package mx.com.matersys.vacs.domain;

import java.util.Date;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.TableGenerator;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.roo.addon.entity.RooEntity;
import org.springframework.roo.addon.javabean.RooJavaBean;
import org.springframework.roo.addon.tostring.RooToString;

@RooJavaBean
@RooToString
@RooEntity(versionField = "", table = "especialista")
public class Especialista {
	@Id
	@TableGenerator(name = "GEN_ESPE", table = "sequence", pkColumnName = "SEQ_NAME", valueColumnName = "SEQ_COUNT", pkColumnValue = "SEQ_ESPE", allocationSize = 1)
	@GeneratedValue(strategy=GenerationType.TABLE, generator="GEN_ESPE")
    @Column(name = "idespecialista")
    private Integer idespecialista;
	
	@ManyToMany
    @JoinTable(name = "especialista_paciente", joinColumns = { @JoinColumn(name = "idespecialista", nullable = false) }, inverseJoinColumns = { @JoinColumn(name = "idpaciente", nullable = false) })
    private Set<Paciente> pacientes;
    
    @OneToMany(mappedBy = "idespecialista")
    private Set<Consulta> consultas;
    
    @ManyToOne(optional = false)
    @JoinColumn(name = "idestatus", referencedColumnName = "idestatus")
    private Estatus idestatus;
    
    @ManyToOne
    @JoinColumn(name = "idtipoespecialista", referencedColumnName = "idtipoespecialista")
    private TipoEspecialista idtipoespecialista;
    
    @Column(name = "apmaterno", length = 30)
    private String apmaterno;
    
    @Column(name = "appaterno", length = 30)
    private String appaterno;
    
    @Column(name = "fechanacimiento")
    @Temporal(TemporalType.TIMESTAMP)
    @DateTimeFormat(style = "M-")
    private Date fechanacimiento;
    
    @Column(name = "nombres", length = 25)
    private String nombres;
    
    @Column(name = "username", length = 20)
    private String username;
    
    @Column(name = "email", length = 55)
    private String email;
    
    @Column(name = "telefono", length = 25)
    private String telefono;
    
    @Column(name = "telefonomovil", length = 25)
    private String telefonomovil;
    
    
}
